package main

import (
	"fmt"
	"gin-demo/Ginit"
	"gin-demo/IOC"
	config2 "gin-demo/config"
	"gin-demo/container"
	"gin-demo/router"
	"gin-demo/timeTask"
	"github.com/gin-gonic/gin"
)

func main() {
	engine := gin.Default()
	//初始化
	Ginit.Main()
	//容器注入
	IOC.Main()
	//从容器中获取配置信息
	config := container.Get("config").(config2.Config)
	router.Router(engine)
	timeTask.CreateTestTimeTaskInit()
	err := engine.Run(fmt.Sprintf("%s:%d", config.Server.ListenAddress, config.Server.Port))
	if err != nil {
		return
	}
}
